package com.introse.student;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;

public class Student {
	private String name;
	private Calendar etp, ltp;
	private HashMap<Integer, ClassDay> days;
	
	public Student(String name, Calendar etp, Calendar ltp) {
		this.name = name;
		this.etp = etp;
		this.ltp = ltp;
	}
	
	public Student(String name, int etpHour, int etpMinute, int ltpHour, int ltpMinute) {
		this.name = name;
		this.etp = Calendar.getInstance();
		this.etp.set(Calendar.HOUR_OF_DAY, etpHour);
		this.etp.set(Calendar.MINUTE, etpMinute);
		this.etp.set(Calendar.SECOND, 0);
		this.ltp = Calendar.getInstance();
		this.ltp.set(Calendar.HOUR_OF_DAY, ltpHour);
		this.ltp.set(Calendar.MINUTE, ltpMinute);
		this.ltp.set(Calendar.SECOND, 0);
		this.days = new HashMap<Integer, ClassDay>();
	}
	
	/**Adds a day (eg, ClassDay.WEDNESDAY) and a series of times for that day
	 * 
	 * @param dayOfWeek The day of the week that the class day represents
	 * @param classTimes The times for the class day
	 */
	public void addClassDay (int dayOfWeek, ClassTime... classTimes) {
		this.days.put(dayOfWeek, new ClassDay(dayOfWeek, classTimes));
	}
	
	/**Get the ClassDay object representing a day of the week
	 * 
	 * @param dayOfWeek A day of the week; use ClassDay constants
	 * @return The ClassDay object (schedule for the dayOfWeek) for this student
	 */
	public ClassDay getClassDay (int dayOfWeek) {
		if (dayOfWeek >= ClassDay.MONDAY && dayOfWeek <= ClassDay.SATURDAY) {
			return this.days.get(dayOfWeek);
		}
		System.out.println("Sorry, dayOfWeek parameter for getClassDay(int dayOfWeek) is wrong. Use ClassDay constants");
		return null;
	}
	
	public static ArrayList<String> getFreeTimesDump(Student student1, Student student2, int dayOfWeek) {
		ClassDay day1 = student1.getClassDay(dayOfWeek);
		ArrayList<ClassTime> times1 = day1.getClassTimes();
		ClassDay day2 = student2.getClassDay(dayOfWeek);
		ArrayList<ClassTime> times2 = day2.getClassTimes();
		
		ArrayList<String> dump = new ArrayList();
		
		
	}
	
}
